package org.lztvn.elearning.controllers;

import org.lztvn.elearning.entities.Category;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value="/result1")
public class ResultController extends AppController {
	@RequestMapping(value="/helloajax",method=RequestMethod.GET)
	@ResponseBody
	public String helloajax(){
		return "Hello Ajax";
	}
	@ResponseBody
	@RequestMapping(value="/sum/{a}/{b}",method=RequestMethod.POST)
	public String sum(@PathVariable(value="a") int a,@PathVariable(value="b") int b){
		return String.valueOf(a+b);
	}
	
	@ResponseBody
	@RequestMapping(value="/json",method=RequestMethod.GET)
	public String json(){
		Category c = new Category("dung", "descsssssssssssssss", null, "nomPhoto", true);
		System.out.println(c.getDescriptionCat());
		return c.getNameCat();
	}
}
